Changed strftime format because %T is being ignored under Windows.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 13 Nov 2005 21:13:07 +0000 (21:13 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 13 Nov 2005 21:13:07 +0000 (21:13 +0000)
Fixed reading of track coordinates.
Added pcx track to reference data and testo sequence.

gpsbabel/pcx.c
gpsbabel/reference/track/pcx.trk [new file with mode: 0644]
gpsbabel/testo

index ede52a006d05a6bc71e652da8382f3e53d0f2d9c..854f95efca5613eff1db127579032cec71b5bf98 100644 (file)
@@ -148,11 +148,11 @@ data_read(void)
                        */
                        if (ibuf[3] == 'L' && ibuf[4] == 'A') {
                                track = route_head_alloc();
-                               track->rte_name = strdup("track");
+                               track->rte_name = xstrdup("track");
                                track_add_head(track);
                        } else if (ibuf[3] == 'T' && ibuf[4] == 'N') {
                                track = route_head_alloc();
-                               track->rte_name = strdup(&ibuf[6]);
+                               track->rte_name = xstrdup(&ibuf[6]);
                                track_add_head(track);
                        }
                        break;
@@ -192,13 +192,18 @@ data_read(void)
                        if (tm.tm_year < 70) tm.tm_year += 100;
                        wpt_tmp = waypt_new();
                        wpt_tmp->creation_time = mkgmtime(&tm);
-                       wpt_tmp->latitude = lat;
-                       wpt_tmp->longitude = lon;
+                       if (read_as_degrees) {
+                               wpt_tmp->longitude = lon;
+                               wpt_tmp->latitude = lat;
+                       } else {
+                               wpt_tmp->longitude = ddmm2degrees(lon);
+                               wpt_tmp->latitude = ddmm2degrees(lat);
+                       }
                        wpt_tmp->altitude = alt;
                        /* Did we get a track point before a track header? */
                        if (track == NULL) {
                                track = route_head_alloc();
-                               track->rte_name = strdup("Default");
+                               track->rte_name = xstrdup("Default");
                                track_add_head(track);
                        }
                        route_add_wpt(track, wpt_tmp);
@@ -272,8 +277,8 @@ pcx_track_hdr(const route_head *trk)
        if (!cartoexplorer) {
                fprintf(file_out, "\n\nH  TN %s\n", name);
        }
+       xfree(name);
        fprintf(file_out, "H  LATITUDE    LONGITUDE    DATE      TIME     ALT  ;track\n");
-
 }
 
 static void
@@ -305,7 +310,7 @@ pcx_track_disp(const waypoint *wpt)
 
        tm = gmtime(&wpt->creation_time);
 
-       strftime(tbuf, sizeof(tbuf), "%d-%b-%y %T", tm);
+       strftime(tbuf, sizeof(tbuf), "%d-%b-%y %H:%M:%S", tm);  /* currently ...%T does nothing under Windows */
        for (tp = tbuf; *tp; tp++) {
                *tp = toupper(*tp);
        }
diff --git a/gpsbabel/reference/track/pcx.trk b/gpsbabel/reference/track/pcx.trk
new file mode 100644 (file)
index 0000000..1e07c73
--- /dev/null
@@ -0,0 +1,73 @@
+H  SOFTWARE NAME & VERSION
+I  PCX5 2.09
+
+H  R DATUM                IDX DA            DF            DX            DY            DZ
+M  G WGS 84               121 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00
+
+H  COORDINATE SYSTEM
+U  LAT LON DM
+H  LATITUDE    LONGITUDE    DATE      TIME     ALT  ;track
+T  N3003.73100 W09136.62100 25-MAY-02 17:06:21 1
+T  N3003.76700 W09136.63400 25-MAY-02 17:09:55 0
+T  N3003.76200 W09136.49600 25-MAY-02 17:12:00 0
+T  N3003.74000 W09136.44300 25-MAY-02 17:12:48 0
+T  N3003.69200 W09136.31700 25-MAY-02 17:14:41 0
+T  N3003.58700 W09135.96400 25-MAY-02 17:17:16 0
+T  N3003.46800 W09135.80100 25-MAY-02 17:17:46 0
+T  N3003.32300 W09135.69400 25-MAY-02 17:18:20 0
+T  N3003.23300 W09135.55700 25-MAY-02 17:19:01 0
+T  N3002.98400 W09135.38500 25-MAY-02 17:20:46 0
+T  N3002.94100 W09135.39300 25-MAY-02 17:21:10 0
+T  N3002.92800 W09135.57600 25-MAY-02 17:21:51 0
+T  N3002.77400 W09135.78700 25-MAY-02 17:22:35 0
+T  N3002.73100 W09135.92300 25-MAY-02 17:23:08 0
+T  N3002.83800 W09136.01600 25-MAY-02 18:04:23 0
+T  N3002.82000 W09135.97800 25-MAY-02 18:06:04 2
+T  N3002.78600 W09135.96800 25-MAY-02 18:07:06 0
+T  N3002.77200 W09135.93700 25-MAY-02 18:08:18 1
+T  N3002.78200 W09135.86400 25-MAY-02 18:10:20 0
+T  N3002.78100 W09135.83000 25-MAY-02 18:11:09 0
+T  N3002.80700 W09135.78000 25-MAY-02 18:12:18 0
+T  N3002.84700 W09135.71200 25-MAY-02 18:14:22 0
+T  N3002.86800 W09135.68600 25-MAY-02 18:15:04 2
+T  N3002.89500 W09135.64500 25-MAY-02 18:16:14 1
+T  N3002.92100 W09135.62800 25-MAY-02 18:17:01 1
+T  N3002.96100 W09135.63100 25-MAY-02 18:18:07 0
+T  N3003.01900 W09135.63900 25-MAY-02 18:19:51 2
+T  N3003.04700 W09135.64700 25-MAY-02 18:20:39 0
+T  N3003.07400 W09135.66200 25-MAY-02 18:21:24 0
+T  N3003.10800 W09135.66200 25-MAY-02 18:22:17 0
+T  N3003.13300 W09135.68000 25-MAY-02 18:23:18 0
+T  N3003.18100 W09135.68100 25-MAY-02 18:24:37 0
+T  N3003.29200 W09135.71200 25-MAY-02 18:28:13 6
+T  N3003.22400 W09135.69600 25-MAY-02 18:31:36 2
+T  N3003.19100 W09135.68700 25-MAY-02 18:32:56 0
+T  N3003.15800 W09135.69000 25-MAY-02 18:34:02 0
+T  N3003.14700 W09135.72600 25-MAY-02 18:36:03 0
+T  N3003.14900 W09135.75800 25-MAY-02 18:36:48 0
+T  N3003.15900 W09135.80700 25-MAY-02 18:37:52 1
+T  N3003.18800 W09135.87100 25-MAY-02 18:39:18 0
+T  N3003.21700 W09135.87800 25-MAY-02 18:40:15 0
+T  N3003.23800 W09135.86600 25-MAY-02 18:41:25 6
+T  N3003.21700 W09135.88500 25-MAY-02 18:42:37 0
+T  N3003.19200 W09135.87500 25-MAY-02 18:44:01 0
+T  N3003.16900 W09135.85100 25-MAY-02 18:45:53 0
+T  N3003.15400 W09135.81600 25-MAY-02 18:46:54 0
+T  N3003.14000 W09135.78600 25-MAY-02 18:47:42 0
+T  N3003.13500 W09135.74100 25-MAY-02 18:48:41 0
+T  N3003.13300 W09135.70100 25-MAY-02 18:49:52 0
+T  N3003.11300 W09135.68200 25-MAY-02 18:50:49 0
+T  N3003.06300 W09135.66400 25-MAY-02 18:52:14 0
+T  N3003.03400 W09135.65400 25-MAY-02 18:52:56 0
+T  N3003.01100 W09135.64600 25-MAY-02 18:53:38 0
+T  N3002.94600 W09135.62300 25-MAY-02 18:55:11 0
+T  N3002.90700 W09135.65500 25-MAY-02 18:56:32 0
+T  N3002.88500 W09135.68500 25-MAY-02 18:57:24 0
+T  N3002.85000 W09135.72700 25-MAY-02 18:58:40 7
+T  N3002.82400 W09135.76000 25-MAY-02 18:59:28 0
+T  N3002.79800 W09135.79600 25-MAY-02 19:00:22 0
+T  N3002.78400 W09135.85900 25-MAY-02 19:01:41 0
+T  N3002.77400 W09135.90800 25-MAY-02 19:02:48 0
+T  N3002.77900 W09135.93800 25-MAY-02 19:03:43 0
+T  N3002.80700 W09135.95700 25-MAY-02 19:04:49 0
+T  N3002.82800 W09135.98000 25-MAY-02 19:05:57 0
index c6ac0fb07bd2f6e91996c2ff669fe55397ebc9fb..d086a363f8465b551b73a5ca953bcbca4e0656ce 100755 (executable)
@@ -140,6 +140,9 @@ rm -f ${TMPDIR}/mm.pcx ${TMPDIR}/pcx.gps
 ${PNAME} -i geo -f geocaching.loc -o pcx -F ${TMPDIR}/mm.pcx
 ${PNAME} -i pcx -f ${TMPDIR}/mm.pcx -o gpsutil -F ${TMPDIR}/pcx.gps
 compare ${TMPDIR}/mm.gps ${TMPDIR}/gu.wpt
+${PNAME} -t -i gpx -f reference/track/tracks.gpx -o pcx -F ${TMPDIR}/pcx.trk
+${PNAME} -t -i pcx -f reference/track/pcx.trk -o pcx -F ${TMPDIR}/pcx2.trk
+compare ${TMPDIR}/pcx.trk ${TMPDIR}/pcx2.trk 
 
 #
 # Magellan file format